
<?php include("header.php"); ?>

<script type="text/javascript">
function isDisabled(id, value)
{
    if (value == '1') {
		value = '0';
	} else {
		value = '1';
	}
    var agr = new Array();
	agr.push(id);
	agr.push(value);
	if(callFunction('Menu::isDisabled',agr) != '1')
	{
		alert('<?php echo _MSG_UNABLE_SAVE_VALUE; ?>');
		return false;
	}

	if (value != '1') {
		document.getElementById("disabled_"+id).style.display = "none";
		document.getElementById("enabled_"+id).style.display = "";
        document.getElementById("lbl_disabled_"+id).style.display = "none";
		document.getElementById("lbl_enabled_"+id).style.display = "";
	} else {
        document.getElementById("disabled_"+id).style.display = "";
		document.getElementById("enabled_"+id).style.display = "none";
        document.getElementById("lbl_disabled_"+id).style.display = "";
		document.getElementById("lbl_enabled_"+id).style.display = "none";
	}
}
</script>
	<div class="one_third">
		<div class="box_tool">
			<div class="box_head"><?php echo _LB_SEARCH; ?></div>
			<div class="box_content" id="filter_panel">
				<table>
				<form name='form_filter' method="post" action="">
				<tr>
					<td width="40%"><?php echo _LB_MENU_NAME; ?></td>
					<td width="60%">
						<input type="text" name="name" id="name" value="<?php echo $filter['name']; ?>" style="width: 180px;"/>
					</td>
				</tr>
                <tr>
					<td class="submit" colspan="2" style="padding-top:10px;">
						<a id="auto_menu_search" class="tribullet" style="float:right" id="obj_search" href="#" onclick="document.form_filter.submit();"><?php echo _LB_FIND;?></a>
					</td>
				</tr>
				</form>
				</table>
			</div>
		</div>
	</div>

	<div class="two_third" style="height:1%">
		<div class="box_two_third">
			<div class="box_head"><?php echo _LB_MENU; ?></div>
			<div class="box_content">
			<?php if($menu->countRows()) { ?>
					<?php while($menu->fetchNext()) { ?>
					<div class="object" robotid="<?php echo $menu->id; ?>">
						<div class="head">
							<div class="right remove_top">
								<a id="auto_menu_edit_<?php echo $menu->id;?>" href="<?php echo APPLICATION_URL;?>/menu/form/<?php echo $menu->id;?>">
									<img src="<?php echo IMG_URL;?><?php echo IMAGE_NAME_EDIT_SMALL;?>" title="<?php echo _LB_EDIT;?>" alt="<?php echo _LB_EDIT;?>"/>
								</a>
								<?php if ($this->session->userdata('id_group') == ADMIN) {?>
                                <span id="enabled_<?php echo $menu->id;?>" <?php if ($menu->disabled == '1') { ?>style="display: none;"<?php } ?>>
                                    <a id="auto_country_enabled_<?php echo $menu->id;?>" href="#disabled<?php echo $menu->id;?>" onclick="javascript:isDisabled(<?php echo $menu->id;?>, '0');">
                                        <img src="<?php echo IMG_URL; ?><?php echo IMAGE_ENABLED_SMALL;?>" title="<?php echo _LB_STATUS_DISABLE;?>" alt="<?php echo _LB_STATUS_DISABLE;?>"/>
                                    </a>
                                </span>
                                <span id="disabled_<?php echo $menu->id;?>" <?php if ($menu->disabled == '0') { ?>style="display: none;"<?php } ?>>
                                    <a id="auto_country_disabled<?php echo $menu->id;?>" href="#enabled_<?php echo $menu->id;?>" onclick="javascript:isDisabled(<?php echo $menu->id;?>, '1');">
                                        <img src="<?php echo IMG_URL; ?><?php echo IMAGE_DISABLED_SMALL;?>" title="<?php echo _LB_STATUS_ENABLE;?>" alt="<?php echo _LB_STATUS_ENABLE;?>"/>
                                    </a>
                                </span>
                                <?php } ?>
							</div>
							<b><?php echo $menu->name;?></b>
						</div>
						<div class="content">
							<table border="0" cellpadding="3" cellspacing="0">
                                <tr>
									<td width="20%"><?php echo _LB_PERMISSION;?>&nbsp;:&nbsp;</td>
									<td>
										<?php echo Group::getPermission($menu->permission); ?>
									</td>
								</tr>
								<tr>
									<td width="20%"><?php echo _LB_STATUS;?>&nbsp;:&nbsp;</td>
									<td>
										<span id="lbl_disabled_<?php echo $menu->id;?>" <?php if ($menu->disabled == '0') { ?>style="display: none;"<?php } ?>>
                                            <?php echo _LB_STATUS_DISABLED;?>
                                        </span>
                                        <span id="lbl_enabled_<?php echo $menu->id;?>" <?php if ($menu->disabled == '1') { ?>style="display: none;"<?php } ?>>
                                            <?php echo _LB_STATUS_ENABLED;?>
                                        </span>
									</td>
								</tr>
							</table>
						</div>
					</div>
					<?php } ?>
			<?php } else { ?>
				<p><?php echo _MSG_NO_EXISTING_MENU;?></p>
			<?php } ?>
			</div>
		</div>
		
	</div>
<?php include("footer.php"); ?>
